
 function calcu(value,rate,time,timeType){
            // value = 数字 ; rate = d ; time = 数字; timeType = 0/1(0代表天，1代表月)
            var Reg = /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/;
            var expect = 0,fee = 0,real = 0;
            if(Reg.test(value)&&value){
                expect = (value*rate/100/(timeType==0?365:12)*time).toFixed(2);
                // fee = (expect*5/100).toFixed(2);
                fee = 0;
                real = (expect - fee).toFixed(2);
            }
            // 返回预期收益,管理费，实际收益
            return {
                expect :  expect,
                fee : fee,
                real : real
            }
       }
   $(function(){
   	$(".invest .calcu").click(function(){
		 var value = $(".form-control").val();
		 var stress=$(".item_da dd .stress").html(); 
		 var stress1=$(".item_da dd .stress1").html(); 
		var rate =(stress*100+stress1*100)/100 ;

		 var time=1;
		 var timeType=0;
		 var result = calcu(value,rate,time,timeType);
           if(result){
               $('#real-return').html(result.expect );
              $('#expect-return').html(result.expect );  
            }
		$(".calcu-panel").show();
		
	});
	$(".close").click(function(){
		$(".calcu-panel").hide();
	});
  //散标计算器
     	$(".invest .calcu1").click(function(){
		 var value = $(".form-control").val();
		 var stress=$(".item_da dd .stress").html(); 
	     var stress1=$(".item_da dd .stress1").html(); 
	     var rate = 0;
	     if(stress1){
	    	 rate =(stress*100+stress1*100)/100 ;
	     }else{
	    	 rate =(stress*100)/100 ;
	     }
		 var time=$("#time").html();
		 var timeType1=$(".item_date dd .unit").val();
		 if(timeType1=="day"){
		 	var timeType=0;
		 }else{
	 		var timeType=1;
		 }
		 //var timeType=0;
		 var result = calcu(value,rate,time,timeType);
           if(result){
               $('#real-return').html(result.expect );
              $('#expect-return').html(result.expect );  
            }
		$(".calcu-panel").show();
		
	});
   })
	/* 跑马灯 */
function marquee_control(maincon,speed,up,down){

    $(maincon).children('ul').html($(maincon).children('ul').html() + $(maincon).children('ul').html());
    var total_width = $(maincon).children("ul").children("li").outerWidth(true) * $(maincon).children("ul").children("li").length;
    
    $(maincon).children("ul").width(total_width);
    var x = 0;
    var t;
    var chg;
    $(maincon).scrollLeft(x);
    function init1(){
        var self = arguments.callee;
        t = setTimeout(function(){
            $(maincon).scrollLeft(x);
            x--;
            
            if(x <= 0){
                x = total_width-$(maincon).width();
            };
            self();
        },speed);
        chg = 1;
    };
    function init2(){
        var self = arguments.callee;
        t = setTimeout(function(){
            $(maincon).scrollLeft(x);
            x++;
            
            if(x >= total_width-$(maincon).width()){
                x = 0;
            };
            self();
        },speed);
        chg = 2;
    };
    init2();
    $(down).click(function(){
        clearTimeout(t);
        init1();
        chg = 1;
    });
    $(up).click(function(){
        clearTimeout(t);
        init2();
        chg = 2;
    });
    $(maincon).mouseover(function(){
        clearTimeout(t);
    });
    $(maincon).mouseout(function(){
        if(chg == 1){
            init1();
        };
        if(chg == 2){
            init2();
        };
    });
}

	

